<div
	style="min-height: 300px; padding-bottom: 20px; width: 98%; float: left"
	class="portlet x12">
	<div class="portlet-header"><h4><?php if (isset($mode) && $mode =='add') { ?>Thêm mới <?php } else { ?> Sửa <?php } ?>bài viết</h4></div>
		<div class="portlet-content" >
			<form class="form label-inline" id="form_edit_add" method="post" action="<?php echo base_url();?>admin/posts/<?php echo $action; ?>">
				<div class="field">
					<label for="fname" >Danh muc</label>
					<select id="catid" name="catid">
						<option value="">--None--</option>
						<?php 								
						if (count($cats>0))
						foreach ($cats as $cat){ ?>
							<option value="<?php echo $cat['id'] ; ?>" <?php if(isset($detail->catid)) echo $detail->catid==$cat['id']?'selected="selected"':''; ?>><?php echo $cat['name']; ?></option>
						<?php }?>
						<option value="99999" <?php if(isset($detail->catid)) echo $detail->catid=='99999'?'selected="selected"':''; ?>>Tuyển dụng</option>
					</select>
				</div>
				<div class="field">
					<label for="fname" >Tiêu đề</label>
					<input type="text" class="medium" size="50" name="subject" id="subject" value="<?php echo (isset($detail->subject))?$detail->subject:"";?>">
				</div>
				<div class="field">
					<label for="fname" >Tiêu đề English</label>
					<input type="text" class="medium" size="50" name="subject_en" id="subject_en" value="<?php echo (isset($detail->subject_en))?$detail->subject_en:"";?>">
				</div>
				<div class="field">
					<label for="description">Chi tiết</label>
				</div>
				<div class="field">
					<?php
					$config_mini = array();

			        $config_mini['toolbar'] = array(
			            array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ,'-', 'Link', 'Unlink', 'Anchor','Image')
			        );
			        $config_mini['filebrowserBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php";
			        $config_mini['filebrowserImageBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php?type=images";
			        $config_mini['filebrowserUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=files";
			        $config_mini['filebrowserImageUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=images";

					echo $this->ckeditor->editor("post_content", (isset($detail->post_content))?$detail->post_content:"");
					?>
				</div>

				<div class="field">
					<label for="description">Chi tiết English</label>
				</div>
				<div class="field">
					<?php
					$config_mini = array();

			        $config_mini['toolbar'] = array(
			            array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ,'-', 'Link', 'Unlink', 'Anchor','Image')
			        );
			        $config_mini['filebrowserBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php";
			        $config_mini['filebrowserImageBrowseUrl'] = base_url()."ckeditor/kcfinder/browse.php?type=images";
			        $config_mini['filebrowserUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=files";
			        $config_mini['filebrowserImageUploadUrl'] = base_url()."ckeditor/kcfinder/upload.php?type=images";

					echo $this->ckeditor->editor("post_content_en", (isset($detail->post_content_en))?$detail->post_content_en:"");
					?>
				</div>

				<br>

				<input type="hidden" name="id" id="id" value="<?php echo (isset($detail->id))?$detail->id:"";?>">
				<div class="buttonrow" align="center" style="margin-left:165px">
					<input type="button" class="btn btn-orange" id="Save" value="Save">
					<input type="button" class="btn btn-grey" id="Cancel" value="Cancel">
				</div>
		</form>
		<br><br>
	</div>
</div>
<script>
$(document).ready(function(){
	$('.btn-grey').live('click',function(){
		 parent.history.back();
	     return false;
	});
	$('.btn').click(function(){
		$('#form_edit_add').submit();
	});
});

</script>